<html><body bgcolor="#000000" text="#ffffff"><table><tr><td colspan="2"><h3>Problem Statement</h3></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td>You're given a set of inequalities. Each of the inequalities refers to the variable X. Determine the maximum subset of the given set which has a solution.<br></br>
<br></br>
To make your task easier, the inequalities in the given set are always reduced to one of the following five forms:<br></br>
<pre>
	X &lt; C
	X &lt;= C
	X = C
	X &gt; C
	X &gt;= C
</pre>
Here, C indicates some non-negative integer constant.<br></br>
<br></br>
The inequalities are given in the vector &lt;string&gt; <b>inequalities</b>, where each element is a single inequality formatted as shown above. Return the maximal number of inequalities of the set which can be satisfied simultaneously.</td></tr><tr><td colspan="2"><h3>Definition</h3></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td>Class:</td><td>Inequalities</td></tr><tr><td>Method:</td><td>maximumSubset</td></tr><tr><td>Parameters:</td><td>vector &lt;string&gt;</td></tr><tr><td>Returns:</td><td>int</td></tr><tr><td>Method signature:</td><td>int maximumSubset(vector &lt;string&gt; inequalities)</td></tr><tr><td colspan="2">(be sure your method is public)</td></tr></table></td></tr><tr><td>&#160;&#160;&#160;&#160;</td></tr><tr><td></td></tr><tr><td colspan="2"><h3>Notes</h3></td></tr><tr><td align="center" valign="top">-</td><td>Note that X doesn't have to be an integer or positive number.</td></tr><tr><td colspan="2"><h3>Constraints</h3></td></tr><tr><td align="center" valign="top">-</td><td><b>inequalities</b> will contain between 1 and 50 elements, inclusive.</td></tr><tr><td align="center" valign="top">-</td><td>Each element of <b>inequalities</b> will be formatted "X &lt;E&gt; &lt;C&gt;", where 'X' is uppercase, &lt;E&gt; is one of "&lt;", "&lt;=", "=", "&gt;=" or "&gt;", and &lt;C&gt; is an integer between 0 and 1000, inclusive, with no extra leading zeroes (all quotes for clarity).</td></tr><tr><td align="center" valign="top">-</td><td>No two elements of <b>inequalities</b> will be equal.</td></tr><tr><td colspan="2"><h3>Examples</h3></td></tr><tr><td align="center" nowrap="true">0)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{&quot;X &lt;= 12&quot;,&quot;X = 13&quot;,&quot;X &gt; 9&quot;,&quot;X &lt; 10&quot;,&quot;X &gt;= 14&quot;}</pre></td></tr></table></td></tr><tr><td><pre>Returns: 3</pre></td></tr><tr><td><table><tr><td colspan="2">Any value between 9 and 10 will satisfy the first, third and fourth inequalities.</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">1)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{&quot;X &lt; 0&quot;,&quot;X &lt;= 0&quot;}</pre></td></tr></table></td></tr><tr><td><pre>Returns: 2</pre></td></tr><tr><td><table><tr><td colspan="2">The solution to the whole set is any negative number.</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">2)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{&quot;X = 1&quot;,&quot;X = 2&quot;,&quot;X = 3&quot;,&quot;X &gt; 0&quot;}</pre></td></tr></table></td></tr><tr><td><pre>Returns: 2</pre></td></tr><tr><td><table><tr><td colspan="2">Obviously, you can choose no more than one equality in addition to the fourth inequality.</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">3)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{&quot;X &lt;= 521&quot;,&quot;X &gt;= 521&quot;,&quot;X = 521&quot;,&quot;X &gt; 902&quot;,&quot;X &gt; 12&quot;,&quot;X &lt;= 1000&quot;}</pre></td></tr></table></td></tr><tr><td><pre>Returns: 5</pre></td></tr><tr><td><table><tr><td colspan="2">The best choice is number 521.</td></tr></table></td></tr></table></td></tr></table><p>This problem statement is the exclusive and proprietary property of TopCoder, Inc.  Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited.  (c)2003, TopCoder, Inc.  All rights reserved.  </p></body></html>
